
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;



namespace Swaf.DataAccess
{
	/// <summary>
	/// Summary description for DataAccessException.
	/// </summary>
	[Serializable]
	public class DataAccessException : BaseException
	{
		public DataAccessException()
		{
		}
		public DataAccessException(string msg)
			:base(msg)
		{
		}
		public DataAccessException(string msg, Exception innerException)
			:base(msg, innerException)
		{
		}
		public DataAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
		}
	}

	[Serializable]
	public class InvalidConnectionClassException : DataAccessException
	{
		public InvalidConnectionClassException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
		}
		public InvalidConnectionClassException(string className, string catalogName)
			:base(String.Format("Invalid connection class ({0}) specified for Connection named {1} in Catalog", className, catalogName))
		{
		}
	}

	[Serializable]
	public class InvalidConnectionInfoException : DataAccessException
	{
		public InvalidConnectionInfoException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :base(info, context)
		{
		}
		public InvalidConnectionInfoException(string connectionInfo, string catalogName, Exception e)
			:base(String.Format("Invalid connection info ({0}) specified for Connection named '{1}' in Catalog", connectionInfo, catalogName), e)
		{
		}
	}

	[Serializable]
	public class DataRequestException : DataAccessException
	{
		public DataRequestException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
		}
		public DataRequestException(string name)
			:base(String.Format("Failure while trying to execute data request named {0}", name))
		{
		}
		public DataRequestException(string name, Exception innerException)
			:base(String.Format("Failure while trying to execute data request named {0}", name), innerException)
		{
		}
		public DataRequestException(string name, string detailedInfo, Exception innerException)
			:base(String.Format("Failure executing data request named '{0}' - Details include: {1}", name, detailedInfo), innerException)
		{
		}
	}

	[Serializable]
	public class DataFormatException : DataAccessException
	{
		public DataFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
		}
		
		public DataFormatException(string formatType, string formatPattern)
			:base(String.Format("Failure trying to format ({0}) data response with pattern '{1}'", formatType, formatPattern))
		{
		}
		
		public DataFormatException(string formatType, string formatPattern, Exception e)
			:base(String.Format("Failure trying to format ({0}) data response with pattern '{1}'", formatType, formatPattern), e)
		{
		}

		public DataFormatException(string message)
			:base(message)
		{
		}

		public DataFormatException(string message, Exception e)
			:base(message, e)
		{
		}
	}

	[Serializable]
	public class DataResponseFormatException : DataAccessException
	{
		public DataResponseFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
		}
		public DataResponseFormatException(string formatterPattern)
			:base(String.Format("Failure trying to create formatter from given formatter pattern '{0}'", formatterPattern))
		{
		}
		public DataResponseFormatException(string formatterPattern, Exception e)
			:base(String.Format("Failure trying to create formatter from given formatter pattern '{0}'", formatterPattern), e)
		{
		}
	}

}
